package cn.ejiajunxy.manager.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import cn.ejiajunxy.manager.LoginActivity;
import cn.ejiajunxy.manager.R;
import cn.ejiajunxy.manager.utils.UserPrefManager;

/**
 * Created by zhangguobao on 2018/3/17.
 */

public class FragmentMine extends Fragment {

    private View mView;
    private TextView tvLogout;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        if (mView == null) {
            mView = LayoutInflater.from(container.getContext()).inflate(R.layout.fragment_mine, container, false);
            init();
        }
        return mView;
    }

    private void init() {
        tvLogout= mView.findViewById(R.id.tvLoginOut);
        tvLogout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                UserPrefManager.saveToken(getContext(), null);
                LoginActivity.start(getContext());
            }
        });
        getChildFragmentManager().beginTransaction().replace(R.id.flContent, FragmentMyOrder.newInstance()).commit();
    }


    @Override
    public void onResume() {
        super.onResume();
    }
}
